import request from '@/utils/request'

import type { PersonalOcrResult, SetShopAuthForm, CompanyOcrResult } from './types'


class APIEnterPersonal {
    /** 上传身份证图片，并且获取身份证信息 */
    static personalOcr(data: any) {
        return request<any, ResponseData<any>>({
            url: '/personal/ocr',
            method: 'POST',
            headers: {
                'Content-Type': 'multipart/form-data'
            },
            data
        })
    }


    /** 店铺认证 */
    static setShopAuth(data: SetShopAuthForm) {
        return request<any, ResponseData<any>>({
            url: '/setShopAuth',
            method: 'POST',
            data
        })
    }

    /** 上传营业执照，并且获取营业执照信息 */
    static companyOcr(data: FormData) {
        return request<any, ResponseData<CompanyOcrResult>>({
            url: '/company/ocr',
            method: 'POST',
            headers: {
                'Content-Type': 'multipart/form-data'
            },
            data
        })
    }

    /** 认证信息回显 */
    static getAuthInfo(type: 'personal' | 'company') {
        return request<any, ResponseData>({
            url: '/getAuthInfo',
            method: 'POST',
            data: { type }
        })
    }


}

export default APIEnterPersonal
